import request from 'src/axios'

/**
 * @description 分页查询条码规则
 * @param { Object } params 查询参数
 * @returns Promise
 */
export const pageBarcode = (params: object) => {
  return request.get('/other/barcode/page', { params })
}

/**
 * @description 查看条码规则
 * @param { String } id 主键
 * @returns Promise
 */
export const viewBarcode = (id: string) => {
  return request.get('/other/barcode', { params: { id } })
}

/**
 * @description 新增条码规则
 * @param { Object } data 新增数据
 * @returns Promise
 */
export const saveBarcode = (data: object) => {
  return request.post('/other/barcode', data)
}

/**
 * @description 修改条码规则
 * @param { Object } data 修改数据
 * @returns Promise
 */
export const updateBarcode = (data: object) => {
  return request.put('/other/barcode', data)
}

/**
 * @description 删除条码规则
 * @param { Array<string> } ids 主键数组
 * @returns Promise
 */
export const deleteBarcode = (ids: Array<string>) => {
  return request.delete('/other/barcode', { data: ids })
}

/**
 * @description 启用条码规则
 * @param { String } id 主键
 * @returns Promise
 */
export const enableBarcode = (id: string) => {
  return request.put('/other/barcode/enable', { id })
}

/**
 * @description 禁用条码规则
 * @param { String } id 主键
 * @returns Promise
 */
export const disableBarcode = (id: string) => {
  return request.put('/other/barcode/disable', { id })
}
